package com.example.hello.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class TestController {
    
    private static final Logger logger = LoggerFactory.getLogger(TestController.class);

    @GetMapping("/test")
    public String test() {
        logger.info("测试接口被调用");
        return "Hello, 这是一个测试接口! 当前时间: " + System.currentTimeMillis();
    }

    @GetMapping("/info")
    public Object getInfo() {
        logger.info("info接口被调用");
        return new Object() {
            public String getMessage() {
                return "欢迎使用测试接口";
            }
            
            public String getTimestamp() {
                return String.valueOf(System.currentTimeMillis());
            }
        };
    }
} 